using System;
using System.Collections.Generic;
using System.Text;

namespace IGGCore
{
    /// <summary>
    /// A game boxscore
    /// It included pitching, batting and related notes
    /// </summary>
    public class Boxscore
    {
        private string m_gameInfo;
        private string m_awayBattingDetails;
        private string m_homeBattingDetails;

        private string m_date;
        private List<Player> m_homeBatting = new List<Player>();
        private List<Player> m_awayBatting = new List<Player>();
        private List<Player> m_homePitching = new List<Player>();
        private List<Player> m_awayPitching = new List<Player>();

        private PitchingTotals m_awayPitchingTotals = new PitchingTotals();
        private PitchingTotals m_homePitchingTotals = new PitchingTotals();
        private BattingTotals m_awayBattingTotals = new BattingTotals();
        private BattingTotals m_homeBattingTotals = new BattingTotals();

        public BattingTotals AwayBattingTotals
        {
            get { return m_awayBattingTotals; }
            set { m_awayBattingTotals = value; }
        }
        
        public BattingTotals HomeBattingTotals
        {
            get { return m_homeBattingTotals; }
            set { m_homeBattingTotals = value; }
        }

        public PitchingTotals AwayPitchingTotals
        {
            get { return m_awayPitchingTotals; }
            set { m_awayPitchingTotals = value; }
        }
        
        public PitchingTotals HomePitchingTotals
        {
            get { return m_homePitchingTotals; }
            set { m_homePitchingTotals = value; }
        }

        public List<Player> HomeBatting
        {
            get { return m_homeBatting; }
            set { m_homeBatting = value; }
        }


        
        public List<Player> AwayBatting
        {
            get { return m_awayBatting; }
            set { m_awayBatting = value; }
        }
        
        public List<Player> HomePitching
        {
            get { return m_homePitching; }
            set { m_homePitching = value; }
        }
        
        public List<Player> AwayPitching
        {
            get { return m_awayPitching; }
            set { m_awayPitching = value; }
        }

        public string Date
        {
            get { return m_date; }
            set { m_date = value; }
        }

        public string GameInfo
        {
            get { return m_gameInfo; }
            set 
            { 
                m_gameInfo = value;
                m_gameInfo = m_gameInfo.Replace("<![CDATA[", "");
                m_gameInfo = m_gameInfo.Replace("]]>", "");
                m_gameInfo = m_gameInfo.Replace(">:", ">:\r\n");
                m_gameInfo = m_gameInfo.Replace("<b>", "\r\n ");
                m_gameInfo = m_gameInfo.Replace("</b>", "");
                m_gameInfo = m_gameInfo.Replace("<br/>", "\r\n");
                m_gameInfo = m_gameInfo.Replace("T:\r\n", "Time:");
                m_gameInfo = m_gameInfo.Replace("Att:\r\n", "Attendance:");
                m_gameInfo = m_gameInfo.Replace("Wind:\r\n", "Wind:");
                m_gameInfo = m_gameInfo.Replace("Weather:\r\n", "Weather:");
            }
        }

        public string AwayBattingDetails
        {
            get { return m_awayBattingDetails; }
            set 
            { 
                m_awayBattingDetails = value;
                m_awayBattingDetails = m_awayBattingDetails.Replace("<![CDATA[", "");
                m_awayBattingDetails = m_awayBattingDetails.Replace("]]>", "");
                m_awayBattingDetails = m_awayBattingDetails.Replace("<br/>", "\r\n");
                m_awayBattingDetails = m_awayBattingDetails.Replace("</b>", "");
                m_awayBattingDetails = m_awayBattingDetails.Replace("<b>", " ");
            }
        }

        public string HomeBattingDetails
        {
            get { return m_homeBattingDetails; }
            set 
            { 
                m_homeBattingDetails = value;
                m_homeBattingDetails = m_homeBattingDetails.Replace("<![CDATA[", "");
                m_homeBattingDetails = m_homeBattingDetails.Replace("]]>", "");
                m_homeBattingDetails = m_homeBattingDetails.Replace("<br/>", "\r\n");
                m_homeBattingDetails = m_homeBattingDetails.Replace("</b>", "");
                m_homeBattingDetails = m_homeBattingDetails.Replace("<b>", " ");
            }
        }

        public class PitchingTotals
        {
            private string m_outs;

            public string Outs
            {
                get { return m_outs; }
                set { m_outs = value; }
            }
            private string m_h;

            public string H
            {
                get { return m_h; }
                set { m_h = value; }
            }
            private string m_r;

            public string R
            {
                get { return m_r; }
                set { m_r = value; }
            }
            private string m_er;

            public string ER
            {
                get { return m_er; }
                set { m_er = value; }
            }
            private string m_bb;

            public string BB
            {
                get { return m_bb; }
                set { m_bb = value; }
            }
            private string m_so;

            public string SO
            {
                get { return m_so; }
                set { m_so = value; }
            }
            private string m_hr;

            public string HR
            {
                get { return m_hr; }
                set { m_hr = value; }
            }
            private string m_bf;

            public string BF
            {
                get { return m_bf; }
                set { m_bf = value; }
            }
            private string m_era;

            public string ERA
            {
                get { return m_era; }
                set { m_era = value; }
            }
        }

        public class BattingTotals
        {
            private string m_ab;

            public string AB
            {
                get { return m_ab; }
                set { m_ab = value; }
            }
            private string m_r;

            public string R
            {
                get { return m_r; }
                set { m_r = value; }
            }
            private string m_h;

            public string H
            {
                get { return m_h; }
                set { m_h = value; }
            }
            private string m_d;

            public string D
            {
                get { return m_d; }
                set { m_d = value; }
            }
            private string m_t;

            public string T
            {
                get { return m_t; }
                set { m_t = value; }
            }
            private string m_hr;

            public string HR
            {
                get { return m_hr; }
                set { m_hr = value; }
            }
            private string m_rbi;

            public string RBI
            {
                get { return m_rbi; }
                set { m_rbi = value; }
            }
            private string m_bb;

            public string BB
            {
                get { return m_bb; }
                set { m_bb = value; }
            }
            private string m_po;

            public string PO
            {
                get { return m_po; }
                set { m_po = value; }
            }
            private string m_da;

            public string DA
            {
                get { return m_da; }
                set { m_da = value; }
            }
            private string m_so;

            public string SO
            {
                get { return m_so; }
                set { m_so = value; }
            }
            private string m_avg;

            public string AVG
            {
                get { return m_avg; }
                set { m_avg = value; }
            }
            private string m_lob;

            public string LOB
            {
                get { return m_lob; }
                set { m_lob = value; }
            }
        }
    }
}
